//
//  CellOfPhone.m
//  UITableView通讯录HomeWork
//
//  Created by dllo on 16/8/5.
//  Copyright © 2016年 dllo. All rights reserved.
//

#import "CellOfPhone.h"

@implementation CellOfPhone
- (instancetype)initWithStyle:(UITableViewCellStyle)style reuseIdentifier:(NSString *)reuseIdentifier {
      self = [super initWithStyle:style reuseIdentifier:reuseIdentifier];
      if (self) {
            _labelname = [[UILabel alloc]init];
            _labelPhoneNumber = [[UILabel alloc]init];
            _labelAddress = [[UILabel alloc]init];
            _image = [[UIImageView alloc]init];

      }
      return self;
}
- (void)layoutSubviews {
      [super layoutSubviews];
      _labelname.frame = CGRectMake(150, 10, 120, 40);
      _image.frame = CGRectMake(10, 10, 100, self.frame.size.height - 40);
      _labelname.font = [UIFont systemFontOfSize:20];
      _labelPhoneNumber.frame = CGRectMake(150, 60, 170, 30);
      _labelPhoneNumber.font = [UIFont systemFontOfSize:15];
      _labelPhoneNumber.textColor = [UIColor grayColor];
      _labelAddress.frame = CGRectMake(150, 100, 170, 30);
      _labelAddress.font = [UIFont systemFontOfSize:15];
      _labelAddress.textColor = [UIColor grayColor];
      [self.contentView addSubview:_labelAddress];
      [self.contentView addSubview:_labelPhoneNumber];
      [self.contentView addSubview:_labelname];
      [self.contentView addSubview:_image];
      _person.name = _labelname.text;
}
- (void)setPerson:(Person *)person {
      _person = person;
      _labelname.text = person.name;
      _labelAddress.text = person.address;
      _labelPhoneNumber.text = person.phoneNumber;
      _image.image = [UIImage imageNamed:person.Icon];
}
@end
